<%@ page import="myschool.util.MybatisUtil" %>
<%@ page import="org.apache.ibatis.session.SqlSession" %>
<%@ page import="myschool.dao.StudentDao" %>
<%@ page import="myschool.entity.Student" %>
<%@ page import="java.util.List" %><%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2023-06-05
  Time: 11:47
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<h2>
     <a href="addStudent.jsp">添加新生</a>
</h2>
<table border="1">
  <%
      SqlSession s = MybatisUtil.get();
      StudentDao mapper = s.getMapper(StudentDao.class);
      List<Student> stus = mapper.search(null, null, null, null, 1, 20);
      MybatisUtil.close(s);
      for(Student stu:stus){
  %>
   <tr>
       <td><%=stu.getStuno()%></td>
       <td><%=stu.getSname()%></td>
       <td><%=stu.getSex()%></td>
       <td><%=stu.getTelephone()%></td>
       <td><%=stu.getWechat()%></td>
       <td><%=stu.getQQ()%></td>
       <td><%=stu.getGradeid()%></td>
       <td><a href="toUpdateStudent.jsp?stuno=<%=stu.getStuno()%>">修改</a></td>
   </tr>
<%}%>
</table>
</body>
</html>
